package com.zhuge_new.Adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lzy.okgo.request.HeadRequest;
import com.makeramen.roundedimageview.RoundedImageView;
import com.zhuge_new.R;
import com.zhuge_new.bean.Redexanmine2Bean;

import java.util.List;

/**
 * Created by lenovo on 2018-09-27.
 */

public class Redexanmine2Adapter extends BaseQuickAdapter<Redexanmine2Bean.ObjectBean,BaseViewHolder> {

    private Context context;
    private Redexanmine2Bean redexanmine2Bean;
    public Redexanmine2Adapter(Context context, Redexanmine2Bean redexanmine2Bean) {
        super(R.layout.item_reddetails, redexanmine2Bean.getObject());
        this.context=context;
        this.redexanmine2Bean=redexanmine2Bean;
    }


    @Override
    protected void convert(BaseViewHolder helper, Redexanmine2Bean.ObjectBean item) {
        helper.setText(R.id.reddetaile_type,item.getThreeNickName());
        helper.setText(R.id.reddetaile_time,item.getSendTime().substring(5,10));
        helper.setText(R.id.reddetaile_money,"￥"+item.getMoney());
        String sendCount=item.getSendCount();
        String getNum=item.getGetNum();
        if (item.getGetNum()==null){
            helper.setText(R.id.reddetaile_state,"0/0");
        }else {
            if (sendCount.equals(getNum)){
                helper.setText(R.id.reddetaile_state,"已领完");
            }else {
                helper.setText(R.id.reddetaile_state,"以领"+getNum+"/"+sendCount+"个");
            }
        }
        RoundedImageView reddetaile_logo=helper.getView(R.id.reddetaile_logo);
        RequestOptions options=new RequestOptions()
                .centerCrop()
                .placeholder(R.mipmap.ic_launcher_round)
                .placeholder(R.mipmap.ic_launcher_round)
                .priority(Priority.HIGH);

        Glide.with(context).load(item.getThreeHeadPhoto()).apply(options).into(reddetaile_logo);

    }
}
